package edu.upf.opencities.manager;

import java.util.List;

import javax.xml.datatype.XMLGregorianCalendar;

import org.springframework.beans.factory.annotation.Autowired;

import edu.upf.opencities.dao.ServiceDAO;
import edu.upf.opencities.datamodel.OSNEntry;
import edu.upf.opencities.datamodel.OSNService;

public class ServiceManagerImpl implements ServiceManager{

    @Autowired
    private ServiceDAO serviceDAO;
	
	@Override
	public String registerService(String mail, String serviceName,
			String servicePassword, String owner, String description,
			String updatePeriod, String section, String latitude,
			String longitude, List<String> tagList) {

		return serviceDAO.registerService(mail, serviceName, servicePassword, 
				owner, description, updatePeriod, 
				section, latitude, longitude, tagList);
	}

	@Override
	public void deleteService(String idOSNService) {
		serviceDAO.deleteService(idOSNService);
		
	}

	@Override
	public OSNService getService(String idOSNService) {
		return serviceDAO.getService(idOSNService);
	}

	@Override
	public List<OSNService> getServicesByMail(String mail) {
		return serviceDAO.getServicesByMail(mail);
	}

	@Override
	public List<OSNService> getServicesBySection(String section) {
		return serviceDAO.getServicesBySection(section);
	}

	@Override
	public List<OSNService> getServicesByTag(String tag) {
		return serviceDAO.getServicesByTag(tag);
	}

	@Override
	public String addEntry(String idOSNService, XMLGregorianCalendar timeStamp,
			String value, String longitude, String latitude) {
		return serviceDAO.addEntry(idOSNService, timeStamp, value, longitude, latitude);
	}

	@Override
	public List<OSNEntry> getEntriesFromService(String idOSNService,
			int numEntries) {
		return serviceDAO.getEntriesFromService(idOSNService, numEntries);
	}

	@Override
	public OSNEntry getLastEntry(String idOSNService) {
		return serviceDAO.getLastEntry(idOSNService);
	}

	@Override
	public void addTwitter(String idOSNService, String consumerKey,
			String consumerSecret, String token, String tokenSecret) {
		serviceDAO.addTwitter(idOSNService, consumerKey, consumerSecret, token, tokenSecret);
		
	}

	@Override
	public boolean loginService(String idOSNService, String servicePassword) {
		return serviceDAO.loginService(idOSNService, servicePassword);
	}


}
